package win.zxshuo.www.controller.apis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import win.zxshuo.www.controller.responses.BooksResponse;
import win.zxshuo.www.service.BookService;
import win.zxshuo.www.service.ChapterService;

@RequestMapping("api/search")
@RestController
public class SearchApiController {

    @Autowired
    BookService bookService;

    @Autowired
    ChapterService chapterService;

    @RequestMapping("/book")
    public BooksResponse searchResults(String bookname){
        BooksResponse booksResponse = new BooksResponse(bookService.searchBook(bookname),chapterService);
        return booksResponse;
    }

}
